<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.front.servlets.trading.ajax.UserZh"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.UserAccount"%>
<%@page import="com.blockchain.front.service.trading.entity.ZhEntity"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.XxWdWt"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.TradingMc"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.Wdwt"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.TradingMr"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.JymmExists"%>
<%@page import="com.blockchain.front.servlets.security.Jymmsz"%>
<%@page import="com.blockchain.front.service.trading.entity.HqEntity"%>
<%@page import="com.blockchain.front.service.trading.entity.WtEntity"%>
<%@page import="com.blockchain.common.enums.JymmType"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.WtCjjl"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.WtMc"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.WtMr"%>
<%@page import="com.blockchain.front.servlets.trading.ajax.Hq"%>
<%@page import="com.blockchain.front.servlets.trading.KlinePro"%>
<%@page import="com.blockchain.front.service.trading.entity.XlbEntity"%>
<%@page import="com.blockchain.front.servlets.financial.CxWt"%>
<%@page import="com.blockchain.front.service.financial.entity.JlEntity"%>
<%@page import="com.blockchain.front.service.trading.TradingManage"%>
<%@page
	import="com.blockchain.front.service.financial.entity.UserZhEntity"%>
<%@page import="com.blockchain.front.service.financial.FinancialManage"%>
<%@page import="com.blockchain.common.enums.IsPass"%>
<%@page import="com.blockchain.front.servlets.trading.KlineBlack"%>
<%@page import="com.blockchain.front.service.security.entity.QbdzEntity"%>
<%@page import="com.blockchain.front.service.common.entity.User"%>
<%@page import="com.blockchain.front.service.common.UserManage"%>
<%@page import="com.blockchain.front.servlets.Logout"%>
<%@page import="com.blockchain.front.servlets.LoginVerify"%>

<head>
<%
	String _TITLE_ = languageDefine.getValue(request, "menu_tradeCenter")+ configureProvider.getProperty(SystemVariable.SITE_NAME);
		CURRENT_SUB_CATEGORY = "JYZX";
		int scid = IntegerParser.parse(request.getParameter("id"));
		FinancialManage financialManage = serviceSession.getService(FinancialManage.class);
		TradingManage tradingManage = serviceSession.getService(TradingManage.class);
		String mmsrsz = "";
		if (blockchainSession == null || blockchainSession.isAuthenticated()) {
			mmsrsz = tradingManage.getMmsr();
		}
		XlbEntity b = tradingManage.getB(scid);
		WtEntity[] cjs = tradingManage.getCjjl(scid, 0);
		HqEntity[] hqlist = tradingManage.hqList();
		JYZX_SELECT_TABLE_INDEX = 0;
		 TradingManage scManage = serviceSession.getService(TradingManage.class);
	     QbdzEntity[] scs=scManage.getXlb();
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><%=_TITLE_%></title>
<meta name="Keywords" content="hketrade">
<meta name="Description" content="hketrade">
<meta name="author" content="hketrade.com">
<meta name="coprright" content="hketrade.com">
<link rel="shortcut icon"
	href="<%=controller.getStaticPath(request)%>/klinepro/fonts/favicon.ico" />
<link rel="stylesheet"
	href="<%=controller.getStaticPath(request)%>/klinepro/fonts/css/font-awesome.min.css">
<link rel="stylesheet"
	href="<%=controller.getStaticPath(request)%>/klinepro/css/style.css"
	id="theme" />
<link rel="stylesheet"
	href="<%=controller.getStaticPath(request)%>/klinepro/css/common.css" />
<link rel="stylesheet"
	href='<%=controller.getStaticPath(request)%>/klinepro/css/chart.css' />

<%-- <link rel="stylesheet" href='<%=controller.getStaticPath(request)%>/Home/css/index_sh.css' /> --%>
<link rel="stylesheet" type="text/css"
	href="<%=controller.getStaticPath(request)%>/css/new825css.css?v20170825" />
<style type="text/css">
.login_text input {
	background: #fff;
	outline: none;
	width: 245px;
	height: 44px;
	padding: 10px 0;
	padding-right: 7px;
	padding-left: 11px;
	line-height: 18px;
	vertical-align: middle;
	color: #333;
	border: 1px solid rgb(225, 225, 225);
	border-radius: 4px;
}

.login_button input {
	width: 250px;
	height: 40px;
	border-radius: 3px;
	background: #0d66bf;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	border: none;
}

.login_text {
	margin-bottom: 17px;
}
</style>
</head>
<body>

	<div id="loading"></div>
	<div class="main-windows">
		<div class="chart_header" style="min-width:1400px;">
			<div
				style="position: relative; margin-left: 20px; width: auto; min-width: 18%; float: left;">
				<a href="/" class="xiaozhu-logo"> <img
					src="<%=controller.getStaticPath(request)%>/images/in_images/logo.png"
					alt="" />
				</a> <a class="back-index"
					href="<%=controller.getPagingItemURI(request, com.blockchain.front.servlets.trading.index.class,scs[0]!=null?scs[0].scid:-1)%>"><%=languageDefine.getValue(request, "other_return")%></a>
			</div>
			<div style="position: relative; margin-left: 20px; width: 250px;">
				<div class="all_coin_price">
					<div class="all_coin_show">
						<%if(scs!=null){
							for(QbdzEntity q:scs){ 
								if(q.scid==scid){
						%>
						<a href=""><img id="market-img"
							src="<%=fileStore.getURL(q.tblj)%>"
							style="float: left; width: 40px; height: 40px; margin-right: 5px;">
							<span id="market-title"> <%StringHelper.filterHTML(out,backgroundDataFlag==2?q.ywm_s:backgroundDataFlag==3?q.zwm_f:q.zwm_s);%>(<%StringHelper.filterHTML(out,q.ywm_s);%>/<%StringHelper.filterHTML(out,q.ywm_m);%>)
						</span><em></em> </a>
						<%}}}%>


					</div>

					<div class="trade-class-box nav-trade-clumn"
						style="width: 260px; left: -15px">
						<div class="trade-class">
							<div class="trade-aside fl" id="hMarketClass">
							</div>
							<div class="trade-bd fl" id="hMarketLists">
								<ul style="display: block">
									<%if(scs!=null){for(QbdzEntity q:scs){ %>
									<li>
									  
                                <%if(q.is_trade.getName().equals(IsPass.S.getName())){%>
									  <a href="<%=controller.getPagingItemURI(request, com.blockchain.front.servlets.trading.KlinePro.class,q.scid)%>">
										<%}else {%>
                                <a href="#" onclick="connotTrade()">
                                
                                <%} %>
											<img
											src="<%if(!StringHelper.isEmpty(q.tblj)){%><%=fileStore.getURL(q.tblj)%><%}%>">
											<span> <%StringHelper.filterHTML(out,backgroundDataFlag==2?q.ywm_s:backgroundDataFlag==3?q.zwm_f:q.zwm_s);%>(<%StringHelper.filterHTML(out,q.ywm_s);%>/<%StringHelper.filterHTML(out,q.ywm_m);%>)
										</span>
									</a></li>
									<%}}%>
								</ul>
							</div>
						</div>


					</div>
					<!--</div>-->
				</div>
			</div>
			<div style="position: relative; margin-left: 20px;">
				<span class="sell color018901"
					style="line-height: 60px; font-size: 36px;" id="market_new_price">--</span>
			</div>
			<div class="chart_header_info"
				style="position: relative; margin-left: 20px;">
				<div class="table">
					<dl class="dl">
						<dd>
							<div class=""><%=languageDefine.getValue(request, "tradeMarket_highestPrice")%></div>
							<div class="dt" style="color: #e83e35" id="market_max_price">--</div>
						</dd>
						<dd>
							<div class=""><%=languageDefine.getValue(request, "tradeMarket_lowestPrice")%></div>
							<div class="dt" style="color: #018901;" id="market_min_price">--</div>
						</dd>
						<dd>
							<div class=""><%=languageDefine.getValue(request, "tradeMarket_buyAPrice")%></div>
							<div class="dt" id="market_buy_price">--</div>
						</dd>
						<dd>
							<div class="">
								<%=languageDefine.getValue(request, "tradeMarket_sellAPrice")%></div>
							<div class="dt" id="market_sell_price">--</div>
						</dd>
						<dd>
							<div class=""><%=languageDefine.getValue(request, "tradeMarket_volume")%></div>
							<div class="dt" id="market_volume">--</div>
						</dd>
						<dd>
							<div class="">
								<%=languageDefine.getValue(request, "tradeMarket_dayUpsAndDowns")%></div>
							<div class="dt" id="market_change">--</div>
						</dd>
					</dl>
				</div>
			</div>
			
			<!-- 头 -->
			<div class="header_menu" style="display: block;">
				<div class="loginpop">
					<div class="user-login-box">
						<%
						if (blockchainSession == null || !blockchainSession.isAuthenticated()) {%>
						<!-- 非登录 -->
						<div class="h-login-btn">
							<span><a
								onclick='loginpop("<%=controller.getURI(request, LoginVerify.class)%>");'><%=languageDefine.getValue(request, "menu_login")%></a></span>
							<span>|</span> <span><a href="/register.html"><%=languageDefine.getValue(request, "menu_register")%></a></span>
						</div>
						<%}else{ 	                 	
	                 		UserManage userManage = serviceSession.getService(UserManage.class);
	                     	User u=userManage.getUser();							
	                 	%>
						<!-- 登录 -->
						<div class="logined-box clearfix">
							<div class="user-name">
								<img
									src="<%=controller.getStaticPath(request)%>/klinepro/images/user-icon.png" />
								<%StringHelper.truncationMpno(out, u.iphone);%>
							</div>
							<div class="user-info-box" style="display: none;">
								<dl class="user-info ">
									<dd class="login-out-btn">
										<a href="<%=controller.getURI(request, Logout.class)%>"><%=languageDefine.getValue(request, "account_quit")%></a>
									</dd>
									<dd>
										<label><i class="user-circle"></i><%=languageDefine.getValue(request, "login_accountNumber")%>ID:</label><%=u.userid %>
									</dd>
									<!-- <dd>
										<label><i class="user-assets"></i>总资产:</label><span id="userFinance">0</span>
									</dd> -->

								</dl>
								<ul class="user-currency-list">
									<li class="li-head"><span class="name"><%=languageDefine.getValue(request, "myAssets_currency")%></span>
										<span class="usa"><%=languageDefine.getValue(request, "myAssets_available")%></span>
										<span class="freeze"><%=languageDefine.getValue(request, "myAssets_freeze")%></span>
									</li>
									<div id="myAssetDetail">
										<li class="li-head"><span class="name">BTC</span> <span
											class="usa">12</span> <span class="freeze">13</span></li>
									</div>
								</ul>
							</div>
						</div>
						<%} %>
					</div>
				</div>
			</div>
			<!--  -->
		</div>
		<div class="main_chart">
			<div class="line-lift-block">
				<div class="main" style="width: 100%;">
					<iframe id="market_chart"
						src="<%=controller.getViewURI(request, KlineBlack.class) + "?scid=" + scid%>"
						style="height: 600px;"></iframe>
						<div class="right_block">
							<table class="log_block">
								<thead>
									<tr>
										<th width="25%"><%=languageDefine.getValue(request, "entrust_time")%></th>
										<th width="25%"><%=languageDefine.getValue(request, "entrust_price")%></th>
										<th width="25%"><%=languageDefine.getValue(request, "entrust_quantity")%></th>
										<th width="25%"><span style="padding-right: 18px;"><%=languageDefine.getValue(request, "entrust_total")%></span></th>
									</tr>
								</thead>
							</table>
							<div class="log_block_body">
								<table>
									<tbody id="marketorderlist" style="background-color:#252525;">
										<%
											if (cjs != null) {
													for (WtEntity c : cjs) {
										%>
										<tr>
											<td class="<%StringHelper.filterHTML(out, c.cs);%>" width="25%">
												<%
													StringHelper.filterHTML(out, c.sj.split(" ")[1]);
												%>
											</td>
											<td class="<%StringHelper.filterHTML(out, c.cs);%>" width="25%">
												<%
													StringHelper.filterHTML(out, c.jg);
												%>
											</td>
											<td class="<%StringHelper.filterHTML(out, c.cs);%>" width="25%">
												<%
													StringHelper.filterHTML(out, c.sl);
												%>
											</td>
											<td class="<%StringHelper.filterHTML(out, c.cs);%>" width="25%">
												<%
													StringHelper.filterHTML(out, c.sl);
												%>
											</td>
										</tr>
										<%
											}
												}
										%>
									</tbody>
								</table>
							</div>
						</div>
						<!-- 委托 -->
						<div class="over_auto" style="height: 55%; width: 70%; float: right;">
							<%-- <div style="width: 100%; height: 30px; line-height: 30px; background: #1c1c1c; color: #c5bfbf; padding-left: 15px;">
								<%=languageDefine.getValue(request, "entrust_entrust")%>
							</div> --%>
							<table class="Transaction no_border_right no_border_left_right">
								<thead>
									<tr style="background-color: #1c1c1c;height: 30px;color: #c5bfbf;">
										<th width="14%"><%=languageDefine.getValue(request, "deal_time")%></th>
										<th width="14%"><%=languageDefine.getValue(request, "entrust_buyOrSell")%></th>
										<th width="14%"><%=languageDefine.getValue(request, "entrust_price")%></th>
										<th width="14%"><%=languageDefine.getValue(request, "entrust_quantity")%></th>
										<th width="14%"><%=languageDefine.getValue(request, "entrust_dealDone")%></th>
										<th width="14%"><%=languageDefine.getValue(request, "entrust_total")%></th>
										<th width="14%"><%=languageDefine.getValue(request, "entrust_operating")%></th>
									</tr>
								<thead>
								
							</table>
							<div class="log_block_body" style="height: 350px">
								<table>
									<tbody id="entrustlist" class="no-border-left-right" style="height: 100%;overflow-y: scroll;overflow-x: hidden;background: #252525 !important">
									</tbody>
								</table>
							</div>
						</div>
						
					</div>
				</div>
				<div class="line-right-block">
					<div class="left_block">
						<div class="left_block_sub2">
							<table class="sell_block">
								<tr>
									<th width="33%"><%=languageDefine.getValue(request, "entrustManager_sell")%></th>
									<th width="34%"><%=languageDefine.getValue(request, "trading_price")%></th>
									<th width="33%"><%=languageDefine.getValue(request, "traded_quantity")%></th>
									<!-- <th width=""><span style="padding-right: 18px;">%</span></th> -->
								</tr>

							</table>
							<div class="sell_block_body">
								<table>
									<tbody id="marketselllist">
										<!-- <tr>
										<td class="sell" width="50">卖16</td>
										<td class="sell" width="80">2501.492994</td>
										<td class="sell" width="120">5</td>
										<td style="width: 100px;"><span class="sellSpan"
											style="width: 100px;"></span></td>
									</tr> -->
									</tbody>
								</table>
							</div>
						</div>
						<!-- <div class="cur-price clearfix" id="market_curr_price">2000万</div> -->
						<div class="left_block_sub1">
							<table class="buy_block">
								<thead>
									<tr>
										<th width="33%"><%=languageDefine.getValue(request, "entrustManager_buy")%></th>
										<th width="34%"><%=languageDefine.getValue(request, "trading_price")%></th>
										<th width="33%"><%=languageDefine.getValue(request, "traded_quantity")%></th>
										<!-- <th width=""><span style="padding-right: 18px;">%</span></th> -->
									</tr>
								</thead>
							</table>
							<div class="buy_block_body">
								<table class="">
									<tbody id="marketbuylist">
										<tr>
											<td class="buy">买1</td>
											<td class="buy">2486.643251</td>
											<td class="buy">8.6899</td>
											<!-- <td width="100"><span class="buySpan"
											style="width: 86.899px;"></span></td> -->
										</tr>
									</tbody>
								</table>
							</div>
							
						</div>
						
					</div>

					<div class="jiaoyi">
						<ul>
							<li class="active">限价交易</li>
							<!-- <li>市价交易</li> -->
							<div class="open" zt="1">↓</div>
						</ul>
						<div class="clear"></div>
						<div class="yincang">
							<div class="fast_tr clear" style="display: block;">
								<a name="mark-trade"></a>
								<form class="ft_box" id="form-buy" style="padding-right: 1%;">
									<dl>
										<%-- <dt style="margin-bottom:10px;">
											<%=languageDefine.getValue(request, "entrustManager_buy")%>&nbsp;
											<%=b._ywm_s%>
										</dt> --%>
										<%-- <dd>
											<p>
												<%=languageDefine.getValue(request, "trading_bestBidPrice")%>:<span
													id="buy_best_price">-</span>
												<%=null==b.ywm_m?"":b.ywm_m%>
											</p>
											<input type="text" id="buy_price" name="price"
												placeholder="<%=languageDefine.getValue(request, "trading_price")%>"
												value="" class="texts">
										</dd> --%>
										
										<dd style="position: relative" class="margin-top30">
	                                        <p id="price-p">价格</p>
	                                        <p><span id="buy_best_price"></span><%=null==b.ywm_m?"":b.ywm_m%></p>
	                                        <input type="text" id="buy_price" name="price" placeholder="" value="" class="texts">
	                                    </dd>
										
										<%-- <dd>
											<p>
												<%=languageDefine.getValue(request, "trading_theLargestToBuy")%>:
												<span class="col_333" id="buy_max">0</span>
												<%=b._ywm_s%>
											</p>
											<input type="text" id="buy_num"
												placeholder="<%=languageDefine.getValue(request, "trading_buyQuantity")%>"
												name="num" class="texts">
										</dd> --%>
										
										<dd style="position: relative">
	                                        <p id="num-p">数量</p>
	                                        <p><span class="col_333" id="buy_max"></span><%=b._ywm_s%></p>
	                                        <input type="text" id="buy_num" placeholder="" name="num" class="texts">
	                                    </dd>
										
										<dd class="total-price">
											<span class="fr col_999">(<%=languageDefine.getValue(request, "trading_fee")%>：<%=Formater.formatAmount_(b.mr_sxfl.multiply(new BigDecimal(100)),3)%>
												%)
											</span> <span><%=languageDefine.getValue(request, "trading_totalPrice")%>:</span>
											<span class="col_333" id="buy_mum">0</span>
											<%=b.ywm_m%>
										</dd>
										<dd class="pwdtrade">
											<input id="buy_paypassword" name="pwtrade"
												placeholder="<%=languageDefine.getValue(request, "rmbWithdraw_tradePassword")%>"
												type="password" class="texts" style="padding: 5px"> <span
												onclick="layertpwd()" class="settings"
												style="top: -26px; float: right; left: -10px"></span>
										</dd>
										<dd>
											<div class="tm_buy">
												<div class="trader_btn">
													<div class="tan_btn" id="tm-buy"></div>
													<input type="button"
														value="<%=languageDefine.getValue(request, "trading_buy")%> "
														onclick="tradeadd_buy();">
												</div>
											</div>
										</dd>
									</dl>

								</form>
								<form class="ft_box nobr" id="form-sell">
									<dl>
										<%-- <dt style="margin-bottom:10px;">
											<%=languageDefine.getValue(request, "trading_sell")%>&nbsp;
											<%=b._ywm_s%>
										</dt> --%>
										<%-- <dd>
											<p>
												<%=languageDefine.getValue(request, "trading_bestSellingPrice")%>:<span
													id="sell_best_price">-</span>
												<%=null==b.ywm_m?"":b.ywm_m%>
											</p>
											<input type="text" id="sell_price" name="price"
												placeholder="<%=languageDefine.getValue(request, "trading_sellPrice")%>"
												class="texts" />
										</dd> --%>
										<dd style="position: relative" class="margin-top30">
	                                        <p id="sell-price-p">价格</p>
	                                        <p><span id="sell_best_price"></span><%=null==b.ywm_m?"":b.ywm_m%></p>
	                                        <input type="text" id="sell_price" name="price"
	                                               placeholder="" class="texts" />
	                                    </dd>
										<%-- <dd>
											<p>
												<%=languageDefine.getValue(request, "trading_theLargestToSell")%>:
												<span id="sell_max">0.00</span>
												<%=b._ywm_s%>
											</p>
											<input type="text" id="sell_num" name="num"
												placeholder="<%=languageDefine.getValue(request, "trading_sellQuantity")%>"
												class="texts">
										</dd> --%>
										<dd>
                                        <p id="sell-num-p">数量</p>
	                                        <p><span id="sell_max">0.00</span><%=b._ywm_s%></p>
	                                        <input type="text" id="sell_num" name="num"
	                                               placeholder=""
	                                               class="texts">
	                                    </dd>
										<dd class="total-price">
											<span class="fr col_999">(<%=languageDefine.getValue(request, "trading_fee")%>：<%=Formater.formatAmount_(b.mc_sxfl.multiply(new BigDecimal(100)),3)%>
												%)
											</span> <span><%=languageDefine.getValue(request, "trading_totalPrice")%>：</span><span
												id="sell_mum">0</span>
											<%=b.ywm_m%>
										</dd>
										<dd class="pwdtrade">
											<input id="sell_paypassword" name="pwtrade"
												placeholder="<%=languageDefine.getValue(request, "trading_tradePassword")%>"
												type="password" class="texts" style="padding-left: 5px;"> <span
												onclick="layertpwd()" class="settings"
												style="top: -26px; float: right; left: -10px"></span>
										</dd>
										<dd>
											<div class="tm_sell">
												<div class="trader_btn ">
													<div class="tan_btn" id="tm-sell"></div>
													<input class="bg_green  " type="button"
														value="<%=languageDefine.getValue(request, "entrustManager_sell")%> "
														onclick="tradeadd_sell();">
												</div>
											</div>
										</dd>
									</dl>
								</form>
							</div>

							<div class=" over_hidden" style="height: 340px; display: none;">
								<form class="ft_box" id="form-market-buy"
									style="padding-right: 1%;">
									<dl>
										<dt
											style="position: relative; font-size: 14px; color: #777777; text-align: center;">
											以市场最优价格买入
										</dt>
										<dd style="position: relative">
											<%-- <p>
												<%=languageDefine.getValue(request, "trading_theLargestToBuy")%>:
												<span class="col_333" id="buy_max">0</span>
												<%=b._ywm_s%>
											</p> --%>
											<p id="trade_p">交易额</p>
                                        	<p><span id="buy_limit-best_price"></span><%=b._ywm_s%></p>
											<input type="text" id="buy_num"
												placeholder="<%=languageDefine.getValue(request, "trading_buyQuantity")%>"
												name="num" class="texts">
										</dd>
										<dd class="total-price">
											<span class="fr col_999">(<%=languageDefine.getValue(request, "trading_fee")%>：<%=Formater.formatAmount_(b.mr_sxfl.multiply(new BigDecimal(100)),3)%>
												%)
											</span> <span><%=languageDefine.getValue(request, "trading_totalPrice")%>:</span>
											<span class="col_333" id="buy_mum">0</span>
											<%=b.ywm_m%>
										</dd>
										<dd class="pwdtrade">
											<input id="buy_paypassword" name="pwtrade"
												placeholder="<%=languageDefine.getValue(request, "rmbWithdraw_tradePassword")%>"
												type="password" class="texts" style="padding-left: 5px;"> <span
												onclick="layertpwd()" class="settings"
												style="top: -26px; float: right; left: -10px"></span>
										</dd>
										<dd>
											<div class="tm_buy">
												<div class="trader_btn">
													<div class="tan_btn" id="tm-buy"></div>
													<input type="button"
														value="<%=languageDefine.getValue(request, "trading_buy")%> "
														onclick="tradeadd_buy();">
												</div>
											</div>
										</dd>
									</dl>
								</form>
								<form class="ft_box nobr" id="form-market-sell">
									<dl>
										<dt style="font-size: 14px; color: #777777; text-align: center; position: relative">
											以市场最优价格卖出
										</dt>
										<dd style="position: relative">
											<%-- <p>
												<%=languageDefine.getValue(request, "trading_bestSellingPrice")%>:<span
													id="sell_best_price">-</span>
												<%=null==b.ywm_m?"":b.ywm_m%>
											</p> --%>
											<p id="trade-num-p">数量</p>
											<p><span id="sell_market_best_price"></span><%=null==b.ywm_m?"":b.ywm_m%></p>
											<input type="text" id="sell_price" name="price"
												placeholder="<%=languageDefine.getValue(request, "trading_sellPrice")%>"
												class="texts" />
										</dd>
										<dd>
											<p>
												<%=languageDefine.getValue(request, "trading_theLargestToSell")%>:
												<span id="sell_max">0.00</span>
												<%=b._ywm_s%>
											</p>
											<input type="text" id="sell_num" name="num"
												placeholder="<%=languageDefine.getValue(request, "trading_sellQuantity")%>"
												class="texts">
										</dd>
										<dd class="total-price">
											<span class="fr col_999">(<%=languageDefine.getValue(request, "trading_fee")%>：<%=Formater.formatAmount_(b.mc_sxfl.multiply(new BigDecimal(100)),3)%>
												%)
											</span> <span><%=languageDefine.getValue(request, "trading_totalPrice")%>：</span><span
												id="sell_mum">0</span>
											<%=b.ywm_m%>
										</dd>
										<dd class="pwdtrade">
											<input id="sell_paypassword" name="pwtrade"
												placeholder="<%=languageDefine.getValue(request, "trading_tradePassword")%>"
												type="password" class="texts" style="padding-left: 5px"> <span
												onclick="layertpwd()" class="settings"
												style="top: -26px; float: right; left: -10px"></span>
										</dd>
										<dd>
											<div class="tm_sell">
												<div class="trader_btn ">
													<div class="tan_btn" id="tm-sell"></div>
													<input class="bg_green  " type="button"
														value="<%=languageDefine.getValue(request, "entrustManager_sell")%> "
														onclick="tradeadd_sell();">
												</div>
											</div>
										</dd>
									</dl>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<%-- <div class="list-tab-box" style="display: none;">
			<table class="f_table" id="investLog_content">
				<tbody>
					<tr>
						<th><%=languageDefine.getValue(request, "accountStatus_available")%>比特币</th>
						<td><span id="my_xnb">0</span></td>
					</tr>
					<tr>
						<th><%=languageDefine.getValue(request, "accountStatus_freeze")%>比特币</th>
						<td><font id="my_xnbd">0</font></td>
					</tr>
					<tr>
						<th><%=languageDefine.getValue(request, "accountStatus_available")%></th>
						<td><span id="my_rmb">0</span></td>
					</tr>
					<tr>
						<th><%=languageDefine.getValue(request, "accountStatus_freeze")%></th>
						<td><font id="my_rmbd">0</font></td>
					</tr>
					<tr>
						<th><%=languageDefine.getValue(request, "myAssets_totalAssets")%></th>
						<td><font id="user_finance">0</font></td>
					</tr>
				</tbody>
			</table>
		</div> --%>
	
	<div class="clear"></div>

	<%-- <div id="all_mask" class="all_mask" style="height: 0px; display: none;"></div>
	<div id="all_mask_loginbox" class="all_mask_loginbox"
		style="display: none;">
		<div class="login_title pl20" style=""><%=languageDefine.getValue(request, "login_login")%></div>
		<form id="form-login" class="mask_wrap login-fb">
			<div class="login_text zin90">
				<div class="mask_wrap_title" style=""><%=languageDefine.getValue(request, "login_accountNumber")%>：
				</div>
				<input type="text" id="login_username" class="login-texts hg40 w250"
					placeholder="ENTER_PHONE_NUMBER" />
			</div>
			<div class="login_text zin80">
				<div class="mask_wrap_title" style=""><%=languageDefine.getValue(request, "login_password")%>：
				</div>
				<input id="login_password" class="login-texts hg40 w250"
					type="password"
					placeholder="<%=languageDefine.getValue(request, "login_pleaseEnterPassword")%>" />
			</div>
			<div class="login_button">
				<input type="button" value="<%=languageDefine.getValue(request, "login_login")%>" onclick="footer_login();" class="btns2  hg40 w250">
			</div>
			<div class="login-footer wwxwwx"
				style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px;">
				<span style="color: #CCC; float: right; margin-right: 25px;">
					<a style="font-size: 12px;" href="/Login/register.html"><%=languageDefine.getValue(request, "login_freeRegister")%></a>｜<a
					href="/Login/findpwd.html" style="font-size: 12px;"><%=languageDefine.getValue(request, "login_forgetPassword")%></a>
				</span>
			</div>
		</form>
		<div class="mask_wrap_close" onclick="wrapClose()">
			<i class="fa fa-times fz_20 move" aria-hidden="true"></i>
		</div>
	</div> --%>
	<%@include file="/WEB-INF/include/login.jsp"%>
	<script type="text/javascript"
		src="<%=controller.getStaticPath(request)%>/klinepro/js/jquery.min.js"></script>
	<script type="text/javascript"
		src="<%=controller.getStaticPath(request)%>/klinepro/js/jquery.cookies.2.2.0.js"></script>
	<script type="text/javascript"
		src="<%=controller.getStaticPath(request)%>/klinepro/js/layer/layer.js"></script>
	<script type="text/javascript"
		src="<%=controller.getStaticPath(request)%>/klinepro/js/posfixed.js"></script>
	<script type="text/javascript"
		src="<%=controller.getStaticPath(request)%>/klinepro/js/doT.min.js"></script>
	<script type="text/javascript"
		src="<%=controller.getStaticPath(request)%>/klinepro/js/jquery-ui.js"></script>
	<script>
    var market = "btc_usd";
    var market_round = 6;
    //var market_round_num=8-6;
    var market_round_num = 6;
    var fee_buy = "0";
    var userid = "0";
    var trade_moshi = 1;
    var getDepth_tlme = null;
    var trans_lock = 0;

    function autotrust(_this, type, cq) {
        if (type == 'sell') {
            $('#buy_price').val($(_this).children().eq(cq).html()).css({'color': '#333', 'font_size': '14px'});
            if ($("#my_rmb").html() > 0) {
                $("#buy_max").html(toNum(($("#my_rmb").html() / $('#buy_price').val()), 6));
            }
            if ($('#buy_num').val()) {
                $("#buy_mum").html(($('#buy_num').val() * $('#buy_price').val()).toFixed(8).toString().replace(/[0]*$/, '').replace(/[\.]*$/, ''));
            }
        }
        if (type == 'buy') {
            $('#sell_price').val($(_this).children().eq(cq).html()).css({'color': '#333', 'fontSize': '14px'});
            if ($("#my_xnb").html() > 0) {
                $("#sell_max").html($("#my_xnb").html());
            }
            if ($('#sell_num').val()) {
                $("#sell_mum").html(($('#sell_num').val() * $('#sell_price').val()).toFixed(8).toString().replace(/[0]*$/, '').replace(/[\.]*$/, ''));
            }
        }
    }
    $('.jiaoyi ul li').click(function () {
        /* $('#market_chart').css({'height': '58%'}); */
        var idx = $(this).index();
        $('.yincang').children().eq(idx).show().siblings().hide();
        $(this).addClass('active').siblings().removeClass('active');
        $('.open').attr({'zt': 1});
    });
    $('.open').click(function () {
        $('.yincang').children().eq(0).show();
        var zt = $(this).attr('zt');
        if (zt == 0) {            
            $('.jiaoyi ul li').eq(0).addClass('active');            
            /* $('#market_chart').css({'height': '58%'}); */
            $(this).attr({'zt': 1});
            $(this).html('↓');
        } else {            
            var a = $('.jiaoyi ul li').removeClass('active');            
            /* $('#market_chart').css({'height': '96%'}); */
            $(this).attr({'zt': 0});
            $('.yincang').children().hide();
            $(this).html('↑');
        }
    });

    $("#hMarketClass").on('mouseenter', 'li', function () {
        var index = $(this).index();
        $("#hMarketLists ul").hide();
        $("#hMarketClass li").removeClass("on")
        $(this).addClass("on");
        $("#hMarketLists ul:eq(" + index + ")").show();
    });

    function hMarketList() {
        $.get('/Ajax/allcoin?t=' + Math.random(), function (d) {
            if (d) {
                var priceTmp = [];
                var cList = [];
                var c = '';
                var li = '';
                for (var i = 0; i < d.length; i++) {
                    c = '<li class="' + (i == 0 ? 'on' : '') + '"><a href="javascript:;">' + d[i].name + '</a></li>';
                    cList.push(c);
                    priceTmp.push(renderHMarketList(d[i]["market"], i));
                }
                $("#hMarketClass").html(cList.join(""))
                $("#hMarketLists").html(priceTmp.join(""))
            }
        }, 'json');
    };

    function renderHMarketList(arr, index) {
        var li = [];
        index = typeof index != 'undefined' ? index : 1;
        if (arr && arr.forEach) {
            li.push('<ul style="' + (index == 0 ? 'display:block' : 'display:none') + '">');
            arr.forEach(function (item) {
                var l = '<li><a href="/Trade/chart/market/' + item[8] + '.html"><img src="/Upload/coin/' + item[9] + '"/><span>' + item[0] + '</span></a></li>';
                li.push(l);
            });
            li.push('</ul>');
        }
        return li.join('');
    }


    function slider() {
        var type = ['sell', 'buy'];
        var round = "3";
        for (var i in type) {
            $("#slider_" + type[i]).slider({
                value: 0, min: 0, max: 100, step: 10, range: "min", slide: function (a, t) {
                    var type = $(t.handle).attr('data_slide');
                    var e = parseFloat($("#" + type + '_max').text());
                    if (isNaN(e)) e = 0;
                    $("#" + type + ' .ui-slider-handle').addClass('ui-state-focus ui-state-active');
                    $("#" + type + "_num").val((e / 100 * t.value).toFixed(8 - parseInt(round)));
                    $("#ratio_num_" + type).text(t.value + "%");
                    if ($('#' + type + '_price').val()) {
                        $("#" + type + "_mum").html(((e / 100 * t.value * $('#' + type + '_price').val())).toFixed(8));
                    }
                }
            })
        }
    }
    slider();
    $('#buy_price,#buy_num,#sell_price,#sell_num').css("ime-mode", "disabled").bind('keyup change', function () {

        var buyPrice = $('#buy_price').val();
        var buyNum = $('#buy_num').val();
        var sellPrice = $('#sell_price').val();
        var sellNum = $('#sell_num').val();

        var buyprice = parseFloat((buyPrice ? buyPrice : 0));
        var buynum = parseFloat((buyNum ? buyNum : 0));
        var sellprice = parseFloat((sellPrice ? sellPrice : 0));
        var sellnum = parseFloat((sellNum ? sellNum : 0));
        var buymum = buyprice * buynum;
        var sellmum = sellprice * sellnum;
        var myrmb = $("#my_rmb").html();
        var myxnb = $("#my_xnb").html();
        var buykenum = 0;
        var sellkenum = 0;
        var feeBuby = 0;

        feeBuby = fee_buy.split("%")[0] ? fee_buy.split("%")[0] : 0;

        if (myrmb > 0) {
            buykenum = (myrmb * (1 - feeBuby / 100) ) / buyprice;
        }
        if (myxnb > 0) {
            sellkenum = myxnb;
        }
        if (buyprice != null && buyprice.toString().split(".") != null && buyprice.toString().split(".")[1] != null) {
            if (buyprice.toString().split('.')[1].length > market_round) {
                $('#buy_price').val(buyprice.toFixed(market_round));
            }
        }
        if (buynum != null && buynum.toString().split(".") != null && buynum.toString().split(".")[1] != null) {
            if (buynum.toString().split('.')[1].length > market_round_num) {
                $('#buy_num').val(toNum(buynum, market_round_num));
            }
        }
        if (sellprice != null && sellprice.toString().split(".") != null && sellprice.toString().split(".")[1] != null) {
            if (sellprice.toString().split('.')[1].length > market_round) {
                $('#sell_price').val(sellprice.toFixed(market_round));
            }
        }
        if (sellnum != null && sellnum.toString().split(".") != null && sellnum.toString().split(".")[1] != null) {
            if (sellnum.toString().split('.')[1].length > market_round_num) {
                $('#sell_num').val(toNum(sellnum, market_round_num));
            }
        }
        if (buymum != null && buymum > 0) {
            $('#buy_mum').html(buymum.toFixed(8).toString().replace(/[0]*$/, '').replace(/[\.]*$/, ''));
        }
        if (sellmum != null && sellmum > 0) {
            $('#sell_mum').html(sellmum.toFixed(8).toString().replace(/[0]*$/, '').replace(/[\.]*$/, ''));
        }
        if (buykenum != null && buykenum > 0 && buykenum != 'Infinity') {
            //$('#buy_max').html(toNum(buykenum,market_round_num));
            $('#buy_max').html(Math.round(buykenum).toFixed(market_round_num).toString().replace(/[0]*$/, '').replace(/[\.]*$/, '')); //
        }
        if (sellkenum != null && sellkenum > 0 && sellkenum != 'Infinity') {
            $('#sell_max').html(sellkenum);
        }
        if ($(this).attr("id") == "buy_num") {
            var buy_num = buynum ? buynum : 0;
            var toNum = buynum / buykenum * 100;
            toNum = toNum < 1 ? toNum == 0 ? 0 : 1 : toNum > 100 ? 100 : toNum;
            $("#slider_buy").find("a").css({"width": toNum + "%", "left": toNum + "%"});
            $("#slider_buy").find("div:eq(2)").css("width", toNum + "%")
            $("#ratio_num_buy").text(Math.round(toNum).toFixed(0) + "%")
        }

        if ($(this).attr("id") == "sell_num") {
            var sell_num = sellnum ? sellnum : 1;
            var sNum = sell_num / myxnb * 100;
            sNum = sNum < 1 ? toNum == 0 ? 0 : 1 : sNum > 100 ? 100 : sNum;
            $("#slider_sell").find("a").css({"width": sNum + "%", "left": sNum + "%"});
            $("#slider_sell").find("div:eq(2)").css("width", sNum + "%")
            $("#ratio_num_sell").text(Math.round(sNum).toFixed(0) + "%")
        }
    }).bind("paste", function () {
        return false;
    }).bind("blur", function () {
        if (this.value.slice(-1) == ".") {
            this.value = this.value.slice(0, this.value.length - 1);
        }
    }).bind("keypress", function (e) {
        var code = (e.keyCode ? e.keyCode : e.which);
        var idName = $(this).attr("id");
        var that = this;
        if (that.value.indexOf(".") == -1) {
            return (code >= 48 && code <= 57) || (code == 46);

        } else {
            if ((idName == "buy_price" || idName == "sell_price") && that.value.split(".")[1] && that.value.split(".")[1].length >= market_round) {
                return false;
            }
            if ((idName == "buy_num" || idName == "sell_num") && that.value.split(".")[1] && that.value.split(".")[1].length >= market_round_num) {
                return false;
            }
            return code >= 48 && code <= 57
        }
    });
    function toNum(num, round) {
        return Math.round(num * Math.pow(10, round) - 1) / Math.pow(10, round);
    }
    function trade_finance(data) {
        if (data['usd']) {
            $("#my_rmb").html(data['usd']);
        } else {
            $("#my_rmb").html('0.00');
        }

        if (data['usdd']) {
            $("#my_rmbd").html(data['usdd']);
        } else {
            $("#my_rmbd").html('0.00');
        }

        if (data['xnb']) {
            $("#my_xnb,#sell_max").html(data['xnb']);
        } else {
            $("#my_xnb,#sell_max").html('0.00');
        }

        if (data['xnbd']) {
            $("#my_xnbd").html(data['xnbd']);
        } else {
            $("#my_xnbd").html('0.00');
        }
    }

    function trade_order(data) {
        var list = '';
        var cont = data.length;
        for (i = 0; i < cont; i++) {
            if (data[i].type == "1") {
                list += '<tr title="<%=languageDefine.getValue(request, "js_thisPriceBuy")%>" onclick="autotrust(this,\'buy\',2)"><td class="buy">' + data[i]['addtime'] + '</td>' +
                    '<td class="buy" >' + '<%=languageDefine.getValue(request, "js_buy")%>' + '</td>' +
                    '<td class="buy" >' + data[i]['price'] + '</td>' +
                    '<td class="buy">' + data[i]['num'] + '</td>' +
                    '<td class="buy">' + data[i]['deal'] + '</td>' +
                    '<td class="buy">' + (data[i]['price'] * data[i]['num']).toFixed(8) + '</td>' +
                    '<td><a class="move" id="' + data[i]['id'] + '" onclick="cancelaa(\'' + data[i]['id'] + '\')" href="javascript:void(0);">撤销</a></td>' +
                    '</tr>';
            } else {
                list += '<tr title="<%=languageDefine.getValue(request, "js_thisPriceSell")%>" onclick="autotrust(this,\'sell\',2)">' +
                    '<td class="sell">' + data[i]['addtime'] + '</td><td class="sell" ><%=languageDefine.getValue(request, "js_sell")%></td>' +
                    '<td class="sell">' + data[i]['price'] + '</td><td class="sell">' + data[i]['num'] + '</td>' +
                    '<td class="sell">' + data[i]['deal'] + '</td><td class="sell">' + (data[i]['price'] * data[i]['num']).toFixed(8) + '</td>' +
                    '<td><a class="move" id="' + data[i]['id'] + '" onclick="cancelaa(\'' + data[i]['id'] + '\')" href="javascript:void(0);"><%=languageDefine.getValue(request, "js_revoke")%></a></td></tr>';
            }
        }
        if (cont >= 8) {
            list += '<tr><td style="text-align:center;" colspan="7"><a href="/Finance/mywt" class="move"><%=languageDefine.getValue(request, "js_moreEntrust")%></a>&nbsp;&nbsp;</td></tr>;'
        }
        $('#entrustlist').html(list);
        if (list) {
            $('.move_weituo').show();
        }
    }

    function trade_depth(data) {
        var list = '';
        if (data['s']) {
            if (data['s'] != 'no') {
                if (data['s']) {
                    var chang = data['s'].length;
                    if (chang > 10) {
                        chang = 10;
                    }
                    var sellk = data['s'].length;
                    for (i = 0; i < data['s'].length; i++) {
                        list += '<dl title="<%=languageDefine.getValue(request, "js_thisPriceSell")%>" style="cursor: pointer;" onclick="autotrust(this,\'sell\',1)">' +
                            '<dt class="sell"  style="width: 40px;padding-left: 5px;"><%=languageDefine.getValue(request, "js_sell")%>' + (sellk - i) + '</dt>' +
                            '<dd class="sell"  style="width: 80px;text-align: right;">' + data['s'][i][0] + '</dd>' +
                            '<dd class="sell"  style="width: 110px;text-align: right;">' + data['s'][i][1] + '</dd>' +
                            '<dd class="sell"  style="width: 120px;text-align: right;">' + (data['s'][i][0] * data['s'][i][1]).toFixed(8) + '</dd>' +
                            '</dl>';
                    }
                }
            }
        }
        $("#selllist").html(list);
        list = '';
        if (data['b']) {
            if (data['b'] != 'no') {
                var i = 0;
                var chang;
                chang = data['b'].length;
                if (chang > 10) {
                    chang = 10;
                }
                for (i = 0; i < chang; i++) {
                    list += '<dl title="<%=languageDefine.getValue(request, "js_thisPriceSell")%>" style="cursor: pointer;" onclick="autotrust(this,\'buy\',1)">' +
                        '<dt class="buy"  style="width: 40px;padding-left: 5px;"><%=languageDefine.getValue(request, "js_buy")%>' + (i + 1) + '</dt>' +
                        '<dd class="buy"  style="width: 80px;text-align: right;">' + data['b'][i][0] + '</dd>' +
                        '<dd class="buy"  style="width: 110px;text-align: right;">' + data['b'][i][1] + '</dd>' +
                        '<dd class="buy"  style="width: 120px;text-align: right;">' + (data['b'][i][0] * data['b'][i][1]).toFixed(8) + '</dd>' +
                        '</dl>';
                }
            }
        }
        $("#buylist").html(list);
    }
    function layertpwd() {
        var html = ['<div id="all_mask" class="all_mask"></div><div id="tpwd" class="all_mask_loginbox" style="height:208px;">',        	
            '<div class="login_title pl20"><%=languageDefine.getValue(request, "setTradePassword_setTradePassword")%></div>',
            '<form id="tpwdsetting" class="set_verify" style="padding-left: 50px;">',
            '<ul class="tpwd">',
            '<li><label for="only"><input type="radio" id="only" value="1" name="aaatpwdsetting"> <%=languageDefine.getValue(request, "setTradePassword_noNeed")%> </label></li>',
            '<li><label for="every"><input type="radio" checked id="every" value="2" name="aaatpwdsetting"> <%=languageDefine.getValue(request, "setTradePassword_need")%></label></li>',
            '</li></ul>',
            '<div class="save_verify"><input type="button"class="btns2" value="<%=languageDefine.getValue(request, "setTradePassword_save")%>" onclick="tpwdsettingaa()" /></div>',
            '<div class="mask_wrap_close" id="pwd_close"><i class="fa fa-times fz_20 move" aria-hidden="true"></i></div>',
            '</form></div>'];
        $('body').append(html.join(""));
        $('#tpwd').css('top', ($(window).height() / 2) - (265 / 2));
        $('.all_mask').css({'height': $(document).height()});
        $('#pwd_close').click(function () {
            $('#tpwd').remove();
            $('#all_mask').remove();
            $('#all_mask').remove();
        })
        $.get('/user/tpwdsetting', function (d) {
            if (d == 1) {
                $('#only').prop('checked', true);
            }
            if (d == 2) {
                $('#every').prop('checked', true);
            }
            if (d == 3) {
                $('#none').prop('checked', true);
            }
        })
    }
    function tpwdsettingaa() {
        var paypassword = $("#aaapaypassword").val();
        var tpwdsetting = $("input[name='aaatpwdsetting']:checked").val();
        if (paypassword == "" || paypassword == null) {
            layer.tips('<%=languageDefine.getValue(request, "js_tradePassword")%>', '#aaapaypassword', {tips: 3});
            return false;
        }
        if (tpwdsetting == "" || tpwdsetting == null) {
            layer.tips('<%=languageDefine.getValue(request, "js_pleaseSelectOne")%>', '#tpwdsetting', {tips: 3});
            return false;
        }
        $.post('/user/uptpwdsetting', {paypassword: paypassword, tpwdsetting: tpwdsetting}, function (d) {
            if (d.status == 1) {
                layer.msg('设置成功', {icon: 1});
                window.location.reload();
            } else {
                layer.msg(d.info, {icon: 2});
            }
        }, 'json');
    }
    function cancelaa(id) {
        $.post("/trade/chexiao.html", {id: id}, function (data) {
            if (data.status == 1) {
                layer.msg(data.info, {icon: 1});
            } else {
                layer.msg(data.info, {icon: 2});
            }
        }, 'json');
    }
    var trans_lock = 0;


	function tradeadd_buy(){//买单
		var mr_max=<%=b.mr_max%>;
		var mr_min=<%=b.mr_min%>;
		var dqj=<%=b.dqj%>;
		   var price =$('#buy_price').val();
	       var num =$('#buy_num').val();
	       var paypassword = $('#buy_paypassword').val();
	       if (price == "" || price == null||price<=0) {
	           layer.tips('<%=languageDefine.getValue(request, "js_enterPrice")%>', '#buy_price', {tips: 3});
	           return false;
	       }
	       if (num == "" || num == null||num <=0) {
	           layer.tips('<%=languageDefine.getValue(request, "js_enterQuantity")%>', '#buy_num', {tips: 3});
	           return false;
	       }
	       var zj=price*num;
	       if(zj<mr_min){
	    	   layer.tips('<%=languageDefine.getValue(request, "js_cannotLessThan")%>'+mr_min+'<%=languageDefine.getValue(request, "js_yuan")%>', '#buy_num', {tips: 3});
	    	   return false;
	       }
	       if(zj>mr_max){
	    	   layer.tips('<%=languageDefine.getValue(request, "js_cannotMoreThan")%>'+mr_max+'<%=languageDefine.getValue(request, "js_yuan")%>', '#buy_num', {tips: 3}); 
	    	   return false;
	       }
	       if(price>(dqj*2)){
			    	if (!window.confirm("<%=languageDefine.getValue(request, "js_isConfirmBuy")%>")) {
			   			return;
			   		}
			}
	       tadding_mr(price,num,paypassword);
	       $("#buy_price").val("");
	       $("#buy_num").val("");
	       $("#buy_paypassword").val("");
	}
	
	function wdwt(){//我的委托
		var data = {"scid" : scid};
		$.ajax({
			type : "post",
			dataType : "html",
			url : wdwt_url,
			data : data,
			success : function(data) {
				var ct = JSON.parse(data);
				if (ct.num>0) {
					 var content = "";
					for (var i = 0; i < ct.msg.length; i++) {
						var s = '<tr>';
						s+= '<td width="180" class="'+ct.msg[i].ys+'">'+ct.msg[i].sj+'</td>';
						s+= '<td width="80"  class="'+ct.msg[i].ys+'">';
						if(ct.msg[i].jyztStatus=="买入") {
							s+='<%=languageDefine.getValue(request, "js_myBuy")%>';
						}
						else {
							s+='<%=languageDefine.getValue(request, "js_mySell")%>';
						}
						s+='</td>';
						s+= '<td class="'+ct.msg[i].ys+'" >'+ct.msg[i].cjjg+'</td>';
						s+= '<td class="'+ct.msg[i].ys+'" >'+ct.msg[i].cjsl+'</td>';
						s+= '<td class="'+ct.msg[i].ys+'" >'+ct.msg[i].ycjsl+'</td>';
						s+= '<td class="'+ct.msg[i].ys+'" >'+ct.msg[i].ze+'</td>';
						s+= '<td width="80">';
						s+= '<a  href="javascript:void(0)" style="color: #e71414;"  onclick="cxwt('+ct.msg[i].wtid+','+ct.msg[i].scid+');"><%=languageDefine.getValue(request, "js_revoke")%></a>';
						s+= '</td>';
						s += '</tr>';
						content += s;
					}
					
					$("#entrustlist").html(content); 
				}else{ 
				 	 layer.open({
						title: '<%=languageDefine.getValue(request, "js_tip")%>',
						content:ct.msg
					});  	
				 } 
			}
		});	
	}
	
	function cxwt(wtid,scid){//撤销委托
		var data = {"scid" : scid,"wtid":wtid};
		$.ajax({
			type : "post",
			dataType : "html",
			url : cxwt_url,
			data : data,
			success : function(data) {
				var ct = eval('(' + data + ')');
				if (ct.num>0) {
					wdwt();
					zh();
				}else{
					console.log(ct.msg);
					layer.open({
						title: '<%=languageDefine.getValue(request, "js_tip")%>',
						content:ct.msg
						}); 	
				}
			}
		});	
		
	} 
	
	//买单提交
	function tadding_mr(price,num,paypassword){
		var data = {"scid" : scid,"price":price,"num":num,"pwtrade":paypassword};
		$.ajax({
			type : "post",
			dataType : "html",
			url : trading_mr_url,
			data : data,
			success : function(data) {
				var ct = JSON.parse(data);
				if (ct.num>0) {
					wdwt();
					mr();
					cjjl();
				}else{
					layer.open({
						title: '<%=languageDefine.getValue(request, "js_tip")%>',
						content:ct.msg.indexOf("err_")!=-1?eval("_error_global."+ct.msg):ct.msg
					}); 	
					
				}
			}
		});	
	}

	function tradeadd_sell(){//卖单
		var mc_max=<%=b.mc_max%>;
		var mc_min=<%=b.mc_min%>;	
		var dqj=<%=b.dqj%>;
		 var price =$('#sell_price').val();
	     var num =$('#sell_num').val();
	     var paypassword = $('#sell_paypassword').val();
	     if (price == "" || price == null||price<=0) {
	         layer.tips('<%=languageDefine.getValue(request, "js_enterPrice")%>', '#sell_price', {tips: 3});
	         return false;
	     }
	     if (num == "" || num == null||num <=0) {
	         layer.tips('<%=languageDefine.getValue(request, "js_enterQuantity")%>', '#sell_num', {tips: 3});
	         return false;
	     }
	     var zj=price*num;
	     if(zj<mc_min){
	  	   layer.tips('<%=languageDefine.getValue(request, "js_cannotLessThan")%>'+mc_min+'<%=languageDefine.getValue(request, "js_yuan")%>', '#sell_num', {tips: 3});
	  	   return false;
	     }
	     if(zj>mc_max){
	  	   layer.tips('<%=languageDefine.getValue(request, "js_cannotMoreThan")%>'+mc_max+'<%=languageDefine.getValue(request, "js_yuan")%>', '#sell_num', {tips: 3}); 
	  	   return false;
	     }
	     if((price*2)<dqj){
			 if (!window.confirm('<%=languageDefine.getValue(request, "js_isConfirmSell")%>')) {
					return;
				}
	       }
	     trading_mc(price,num,paypassword);
	     $("#sell_price").val("");
	     $("#sell_num").val("");
	     $("#sell_paypassword").val("");
	}
	//卖单提交
	function trading_mc(price,num,paypassword){
		var data = {"scid" : scid,"price":price,"num":num,"pwtrade":paypassword};
		$.ajax({
			type : "post",
			dataType : "html",
			url : trading_mc_url,
			data : data,
			success : function(data) {
				var ct = JSON.parse(data);
				if (ct.num>0) {
					wdwt();
					zh();
				}else{
					layer.open({
						title: '<%=languageDefine.getValue(request, "js_tip")%>',
						content:ct.msg.indexOf("err_")!=-1?eval("_error_global."+ct.msg):ct.msg
					}); 	
					
				}
			}
		});	
	}

    $('#trade_top').hover(function () {
        $('#trade_list').show();
    }, function () {
        $('#trade_list').hide();
    });
    $('#trade_list').hover(function () {
        $('#trade_list').show();
    }, function () {
        $('#trade_list').hide();
    });

    $('#game_top').hover(function () {
        $('#game_list').show();
    }, function () {
        $('#game_list').hide();
    });
    $('#game_list').hover(function () {
        $('#game_list').show();
    }, function () {
        $('#game_list').hide();
    });
    $('#user_top').hover(function () {
        $('#mywallet_list').show();
    }, function () {
        $('#mywallet_list').hide();
    });
    $('#mywallet_list').hover(function () {
        $('#mywallet_list').show();
    }, function () {
        $('#mywallet_list').hide();
    });
    $('#theme_top').hover(function () {
        $('#theme_list').show();
    }, function () {
        $('#theme_list').hide();
    });
    $('#theme_list').hover(function () {
        $('#theme_list').show();
    }, function () {
        $('#theme_list').hide();
    });
    $(document).ready(function () {
        var theme = $.cookies.get("theme");
        if (theme) {
            $('#theme').attr("href", "/static/default/home/css/" + theme + ".css");
        } else {
        }
    });
    function chose_theme(theme) {
        $.cookies.set("theme", theme);
        window.location.reload();
    }
    $('#lang_top').hover(function () {
        $('#lang_list').show();
    }, function () {
        $('#lang_list').hide();
    });
    $('#lang_list').hover(function () {
        $('#lang_list').show();
    }, function () {
        $('#lang_list').hide();
    });

    function chose_lang(lang) {
        $.cookies.set("lang", lang);
        window.location.reload();
    }
    $('#moban_top').hover(function () {
        $('#moban_list').show();
    }, function () {
        $('#moban_list').hide();
    });
    $('#moban_list').hover(function () {
        $('#moban_list').show();
    }, function () {
        $('#moban_list').hide();
    });
</script>
	<script>
    function autoHeight() {
    	var width = $(window).width();
        var height = $(window).height();
        var chart_header = "60";
        var main_body_height = $(window).height() - chart_header;
        if (width < 1536) {
            width = 1536;
        }
        $(".main_chart").css("width", '100%');
        $(".chart_header").css("width", '100%');
        //$(".main_chart").css("height", main_body_height);
        $(".line-lift-block").css("width", '65%');
        $(".line-right-block").css("height", '100%');
        $(".line-right-block").css("width", '34%');
    }
    window.onresize = autoHeight;
    $(function () {
        autoHeight();
        setTimeout(function () {
            $("#loading").hide();
            $('#marketselllist').scrollTop($('#marketselllist')[0].scrollHeight);
        }, 1000);
    });

    $("#marketselllist").on("click", "tr", function () {
        var that = $(this);
        var price = that.find("td:eq(1)").text();
        $("#sell_price").val(price);
    });
    $("#marketbuylist").on("click", "tr", function () {
        var that = $(this);
        var price = that.find("td:eq(1)").text();
        $("#buy_price").val(price).change();
    });

</script>
	<script type="text/javascript">
    var is_login = 0    ;
    $(function () {


        var topTime2 = 0;
        $(".all_coin_price .all_coin_show").hover(function () {
            clearInterval(topTime2);
            $(this).siblings(".trade-class-box ").show();
        }, function () {
            var _this = $(this);
            topTime2 = setInterval(function () {
                _this.siblings(".trade-class-box").hide();
            }, 100);
        });

        $(".all_coin_price .nav-trade-clumn").hover(function () {
            clearInterval(topTime2);
        }, function () {
            $(this).hide();
        });

        //get_json();
        var $li = $('.trade-nav-move > dd');
        var $ul = $('#all_coins > ul');
        $li.mouseover(function () {
            var $this = $(this);
            var $t = $this.index();
            $li.removeClass();
            $this.addClass('current');
            $ul.css('display', 'none');
            $ul.eq($t).css('display', 'block');
        });

        if (is_login) {
            $.getJSON("/Ajax/allfinance?t=" + Math.random(), function (data) {
                $('#userFinance').html(data);
            });
        }

        var topTime = 0;
        $(".logined-box .user-name").hover(function () {
            clearInterval(topTime);
            $(".user-info-box").show();
        }, function () {
            var _this = $(this);
            topTime = setInterval(function () {
                $(".user-info-box").hide();
            }, 1000);
        });
        $(".user-info-box").hover(function () {
            clearInterval(topTime);
        }, function () {
            $(this).hide();
        });
    });


    function setMarketSell(str) {
        var strArr = [];
        var tArr = [];
        var i = 0;

        if (str) {
            tArr = str.split("</tr>");
            if ([].map) {
                strArr = tArr.map(function (item) {
                    if (item) {
                        return item + '</tr>';
                    }
                });
            } else {
                for (; i < tArr.length; i++) {
                    if (tArr[i]) {
                        strArr.push(tArr[i] + '</tr>');
                    }
                }

            }

        }
        if ([].reverse) {
            strArr.reverse();
        }
        return strArr.join("");
    }
   
    function trade_menu(data) {
        if (data) {
            for (var i in data) {
                $('.menu_price_zx_' + i).html(data[i]['price']);
            }
        }
    }
    function maxArrayKey(arr, key) {
        var a = 0;
        for (var i in arr) {
            a = Math.max(arr[i][key], a);
        }
        return a;
    }
</script>

	<script>
    $(function () {
        var userid = "";
        if (window.location.hash == '#login') {
            if (!userid) {
                loginpop();
            }
        }
        var move_moble = $.cookies.get('move_moble');
        if (move_moble != '' && move_moble != null) {
            $("#login_moble").val(move_moble);
        }
    });
    function check_zzc() {
        $.getJSON("/ajax/check_zzc/t=" + Math.random(), function () {
            setTimeout('check_zzc()', 5000);
        });
    }
    function login_verify_ups() {
        $('#login_verify_up').attr('src', "/ajax/verify.html?t=" + Math.random());
    }
    function loginpop(path) {
        $('.all_mask').css({'height': $(document).height()});
        $('.all_mask').show();
        $('.all_mask_loginbox').show();
        $("#login_yzm").attr('src',path+'?'+Math.random()); 
    }
    function goolepop() {
        var height = $(document).height();
        if (height < 1000) {
            height = 1000;
        }
        $('.all_mask').css({'height': height});
        $('.all_mask').show();
        $('#all_mask_goolebox').show();
    }
    function wrapClose() {
        $('.all_mask').hide();
        $('.all_mask_loginbox').hide();
    }

    $("#login_password").on("keydown", function (e) {
        if (e.keyCode == "13") {
            footer_login();
        }
    })

    function footer_login() {
        var username = $("#login_username").val();
        var password = $("#login_password").val();
        var verify = $("#login_verify").val();
        if (username == "" || username == null) {
            layer.tips('<%=languageDefine.getValue(request, "login_pleaseEnterPhone")%>', '#login_username', {tips: 3});
            return false;
        }
        if (password == "" || password == null) {
            layer.tips('<%=languageDefine.getValue(request, "login_pleaseEnterPassword")%>！', '#login_password', {tips: 3});
            return false;
        }

        $.post("/Login/submit.html", {
            username: username,
            password: password,
            verify: verify,
        }, function (data) {
            if (data.status == 1) {
                $.cookies.set('cookie_moble', username);
                layer.msg(data.info, {icon: 1});
                window.location = '/Finance';
            } else {
                //XXX刷新验证码
                $(".reloadverifyindex").click();
                layer.msg(data.info, {icon: 2});
                if (data.url) {
                    window.location = data.url;
                }
            }
        }, "json");
    }
</script>
	<script type="text/javascript">
var scid=<%=scid%>;
var hq_url='<%=controller.getURI(request, Hq.class)%>';
var wd_mr_url='<%=controller.getURI(request, WtMr.class)%>';
var wd_mc_url='<%=controller.getURI(request, WtMc.class)%>';
var wtcjjl_url='<%=controller.getURI(request, WtCjjl.class)%>';
var jymm_url='<%=controller.getURI(request, JymmExists.class)%>';
var trading_mr_url='<%=controller.getURI(request, TradingMr.class)%>';
var wdwt_url='<%=controller.getURI(request, Wdwt.class)%>';
var trading_mc_url='<%=controller.getURI(request, TradingMc.class)%>';
var cxwt_url='<%=controller.getURI(request, XxWdWt.class)%>';
var zh_url='<%=controller.getURI(request, UserAccount.class)%>';
$(function(){
	hq();//行情2
	mr();//买入1
	mc();//卖出1
	cjjl();//成交记录  5
	
	window.setInterval("mr();mc();",1000);
	window.setInterval("hq();",2000);
	window.setInterval("cjjl();",5000);	
	<%if (blockchainSession == null || blockchainSession.isAuthenticated()) {%>
		zh();//我的账户信息
		window.setInterval("zh();",2000);
		wdwt();//我的委托;
		window.setInterval("wdwt();",2000);
	<%}%> 
});

function zh(){//我的账户信息
	$.ajax({
		type : "post",
		dataType : "html",
		url : zh_url,
		success : function(data) {
			console.log(data);
			var ct = JSON.parse(data);
			if(ct.num>0) {
				var content = [];	
				for(var i=0;i<ct.msg.length;i++){
					if(i==ct.msg.length-1) {
						continue;
					}
					var s = '<li class="li-head"><span class="name">'+ct.msg[i].coinShortName.toUpperCase()+
					'</span><span class="usa">'+parseFloat(ct.msg[i].available).toFixed(2)+
					'</span><span class="freeze">'+parseFloat(ct.msg[i].frozen).toFixed(2)+'</span></li>';
					content.push(s);				
				}	
				$("#myAssetDetail").html(content.join(""));
			}
		}
	});
}

function hq(){//行情
	var data = {"scid" : scid};
		$.ajax({
			type : "post",
			dataType : "html",
			url : hq_url,
			data : data,
			success : function(data) {
				var ct = JSON.parse(data);
				if (ct.num>0) {
				$("#market_new_price").html(ct.msg.dqj);
				$("#market_max_price").html(ct.msg.zgj);
				$("#market_min_price").html(ct.msg.zdj);	
				$("#market_buy_price").html(ct.msg.mr_yj);
				$("#market_sell_price").html(ct.msg.mc_yj);
				$("#market_volume").html(ct.msg.cjl);
				$("#market_change").html(ct.msg.rzd+"%");
				$("#sell_best_price").html(ct.msg.mr_yj);
				$("#buy_best_price").html(ct.msg.mc_yj);
				if(ct.msg.rzd>0){
					$('#market_change').removeClass('green');
				    $('#market_change').addClass('text_red');
				}
				scid=ct.msg.scid;
				}
			}
		});
}

function mr(){//买入
	var data = {"scid" : scid};
	 $.ajax({
			type : "post",
			dataType : "html",
			url : wd_mr_url,
			data : data,
			success : function(data) {
				var ct = JSON.parse(data);
				if (ct.num>0) {
					var content = [];	
					for(var i=0;i<ct.msg.length;i++){
					var jg=ct.msg[i].jg.replace(",",""); 
					var s=['<tr title="<%=languageDefine.getValue(request, "js_thisPriceBuy")%>" onclick="buy_ell('+jg+',1);">',
					'<td class="buy" width="33%"><%=languageDefine.getValue(request, "js_buy")%>'+(i+1)+'</td>',
					'<td class="buy" width="34%">'+ct.msg[i].jg+'</td>',
					'<td class="buy" width="33%">'+ct.msg[i].sl+'</td>',
					/* '<td width="100"><span class="buySpan" style="width: 86.899px;"></span></td>', */
					'</tr>'];
					content.push(s.join(""));				
					}	
					$("#marketbuylist").html(content.join(""));
				}
			}
		});
		
}

function mc() {//卖出
	var data = {
		"scid" : scid
	};
	$.ajax({
		type : "post",
		dataType : "html",
		url : wd_mc_url,
		data : data,
		success : function(data) {
			var ct = JSON.parse(data);
			if (ct.num > 0) {
				var content = [];
				  for (var i=0;i<ct.msg.length;i++) { 
					 var jg=ct.msg[i].jg.replace(",",""); 
					 var s=['<tr title="<%=languageDefine.getValue(request, "js_thisPriceSell")%>" onclick=" buy_ell('+jg+',2);">',
						'<td class="sell" width="33%"><%=languageDefine.getValue(request, "js_sell")%>'+(i+1)+'</td>',
						'<td class="sell"  width="34%">'+ct.msg[i].jg+'</td>',
						'<td class="sell"  width="33%">'+ct.msg[i].sl+'</td>',
						/* '<td style="width: 100px;"><span class="sellSpan" style="width: 100px;"></span></td>', */
					'</tr>'];
					 content.push(s.join(""));					 
				}
				$("#marketselllist").html(content.join(""));
			}
		}
	});
}

//成交记录
function cjjl() { 
	var data = {
		"scid" : scid
	};
	$.ajax({
		type : "post",
		dataType : "html",
		url : wtcjjl_url,
		data : data,
		success : function(data) {
			var ct = JSON.parse(data);
			if (ct.num > 0) {
				var content = [];
				for (var i = 0; i < ct.msg.length; i++) {
					var s=['<tr>',
					'<td class="'+ct.msg[i].cs+'" width="70">'+ct.msg[i].sj.split(" ")[1]+'</td>',
					'<td class="'+ct.msg[i].cs+'" width="70">'+ct.msg[i].jg+'</td>',
					'<td class="'+ct.msg[i].cs+'" width="100">'+ct.msg[i].sl+'</td>',
					'<td class="'+ct.msg[i].cs+'">'+ct.msg[i].ze+'</td>',
					'</tr>'];
					content.push(s.join(""));
				}
				$("#marketorderlist").html(content.join(""));
			}
		}
	});
}
function buy_ell(jg, type) {
	if (type == 1) {
		$("#sell_price").val(jg); 
	}
	if (type == 2) {
		$("#buy_price").val(jg); 
	}
}

var mr_sxfl =<%=b.mr_sxfl%>//买入手续费率
var ws=<%=b.ws%>//位数
function mr_max_km(){//最大可买
 var mr_je=parseFloat($("#buy_price").val());//买入价格
 var km=((parseFloat(cny_ky)/mr_je)).toFixed(8); 
 var max_km=km.substring(0,km.lastIndexOf('.')+(ws+1));
 if(mr_je>0&&mr_je!=""){
	$("#buy_max").html(max_km);
 }
}

function connotTrade(){
	layer.open({  
        content: '<%=languageDefine.getValue(request, "js_nottrade")%>',  
        btn: ['<%=languageDefine.getValue(request, "js_confirm")%>'],  
        
    }); 
}
</script>
</body>
<script>
    $(document).ready(function () {
        $.each($(".mv-hide"), function () {
            eval($(this).html());
        });
    });
</script>
</html>